#include "MainMenuLayer.h"
#include "BackstoryScene.h"
#include "IntroScene.h"

using namespace cocos2d;

bool MainMenuLayer::init() {
	std::string _ngNormal = "Images\\Main Menu\\new_game_normal.png";
	std::string _ngSelected = "Images\\Main Menu\\new_game_selected.png";
	CCSprite* _cgBox = CCSprite::spriteWithFile("Images\\Main Menu\\continue_box.png");
	std::string _cgNormal = "Images\\Main Menu\\profile_normal.png";
	std::string _cgSelected = "Images\\Main Menu\\profile_selected.png";
	std::string _cgDisabled = "Images\\Main Menu\\profile_disabled.png";

	CCMenuItemImage* _ngButton = CCMenuItemImage::itemWithNormalImage(_ngNormal.c_str(), _ngSelected.c_str(), _ngNormal.c_str(), 
		this, menu_selector(MainMenuLayer::newGameCallback));
	_ngButton->setPosition(0, 250);

	CCMenuItemImage* _cgButton1 = CCMenuItemImage::itemWithNormalImage(_cgNormal.c_str(), _cgSelected.c_str(), _cgDisabled.c_str(), 
		this, menu_selector(MainMenuLayer::continueGameCallback1));
	_cgButton1->setPosition(-225, -75);
	_cgButton1->setIsEnabled(false);

	CCMenuItemImage* _cgButton2 = CCMenuItemImage::itemWithNormalImage(_cgNormal.c_str(), _cgSelected.c_str(), _cgDisabled.c_str(), 
		this, menu_selector(MainMenuLayer::continueGameCallback2));
	_cgButton2->setPosition(0, -75);
	_cgButton2->setIsEnabled(false);

	CCMenuItemImage* _cgButton3 = CCMenuItemImage::itemWithNormalImage(_cgNormal.c_str(), _cgSelected.c_str(), _cgDisabled.c_str(), 
		this, menu_selector(MainMenuLayer::continueGameCallback3));
	_cgButton3->setPosition(225, -75);
	_cgButton3->setIsEnabled(false);

	CCMenu *myMenu= CCMenu::menuWithItems(_ngButton, _cgButton1, _cgButton2, _cgButton3, NULL);

	_cgBox->setPositionX(400);
	_cgBox->setPositionY(250);

	this->addChild(_cgBox, 0);
	this->addChild(myMenu, 1);

	return true;
}

void MainMenuLayer::newGameCallback(CCObject* pSender) {
	//CCScene *newGameScene = BackstoryScene::scene();
	CCScene *newGameScene = IntroScene::scene();
	CCTransitionFade* myFade = CCTransitionFade::transitionWithDuration(3, newGameScene);

	CCDirector::sharedDirector()->replaceScene(myFade);
}

void MainMenuLayer::continueGameCallback1(CCObject* pSender) {

}

void MainMenuLayer::continueGameCallback2(CCObject* pSender) {

}

void MainMenuLayer::continueGameCallback3(CCObject* pSender) {

}

void MainMenuLayer::menuCloseCallback(CCObject* pSender) {
	CCDirector::sharedDirector()->end();
}
